package com.zxr.system.service.impl;

import java.util.List;
import com.zxr.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zxr.system.mapper.ContractsMapper;
import com.zxr.system.domain.Contracts;
import com.zxr.system.service.IContractsService;
import com.zxr.common.core.text.Convert;

/**
 * 合同Service业务层处理
 * 
 * @author zxrproject
 * @date 2025-04-26
 */
@Service
public class ContractsServiceImpl implements IContractsService 
{
    @Autowired
    private ContractsMapper contractsMapper;

    /**
     * 查询合同
     * 
     * @param contractId 合同主键
     * @return 合同
     */
    @Override
    public Contracts selectContractsByContractId(Long contractId)
    {
        return contractsMapper.selectContractsByContractId(contractId);
    }

    /**
     * 查询合同列表
     * 
     * @param contracts 合同
     * @return 合同
     */
    @Override
    public List<Contracts> selectContractsList(Contracts contracts)
    {
        return contractsMapper.selectContractsList(contracts);
    }

    /**
     * 新增合同
     * 
     * @param contracts 合同
     * @return 结果
     */
    @Override
    public int insertContracts(Contracts contracts)
    {
        contracts.setCreateTime(DateUtils.getNowDate());
        return contractsMapper.insertContracts(contracts);
    }

    /**
     * 修改合同
     * 
     * @param contracts 合同
     * @return 结果
     */
    @Override
    public int updateContracts(Contracts contracts)
    {
        return contractsMapper.updateContracts(contracts);
    }

    /**
     * 批量删除合同
     * 
     * @param contractIds 需要删除的合同主键
     * @return 结果
     */
    @Override
    public int deleteContractsByContractIds(String contractIds)
    {
        return contractsMapper.deleteContractsByContractIds(Convert.toStrArray(contractIds));
    }

    /**
     * 删除合同信息
     * 
     * @param contractId 合同主键
     * @return 结果
     */
    @Override
    public int deleteContractsByContractId(Long contractId)
    {
        return contractsMapper.deleteContractsByContractId(contractId);
    }
}
